package hbt;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;
//import org.hibernate.tool.hbm2ddl.SchemaExport;

public class HibernateFactory
{
    private static final SessionFactory sessionFactory;
    static
    {
        try
        {
        	System.out.println("Entro al SF");
        	
        	 AnnotationConfiguration config = new AnnotationConfiguration(); 
        	 config.addAnnotatedClass(entities.Cliente.class);
        	 config.addAnnotatedClass(entities.Clase.class);
        	 config.addAnnotatedClass(entities.CuotaPaga.class);
        	 config.addAnnotatedClass(entities.DatosFisicos.class);
        	 config.addAnnotatedClass(entities.Ejercicio.class);
        	 config.addAnnotatedClass(entities.ItemRutina.class);
        	 config.addAnnotatedClass(entities.Locker.class);
        	 config.addAnnotatedClass(entities.Maquina.class);
        	 config.addAnnotatedClass(entities.OpcionDias.class);
        	 config.addAnnotatedClass(entities.OpcionHoraria.class);
        	 config.addAnnotatedClass(entities.Profesor.class);
        	 config.addAnnotatedClass(entities.Rutina.class);
             sessionFactory = config.buildSessionFactory();
        }
        catch (Throwable ex)
        {
            System.err.println("Initial SessionFactory creation failed." + ex);
            throw new ExceptionInInitializerError(ex);
        }
    }
  
    public static SessionFactory getSessionFactory()
    {
        return sessionFactory;
    }
}
